package com.galaxis.wms.security.login;

import com.galaxis.wms.EnumConstant;
import com.galaxis.wms.entity.BasLoginAgent;
import com.yvan.security.config.TokenConfig;
import com.yvan.security.login.AddJwtTokenExtData;
import com.yvan.security.model.UserInfo;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 作者：lizw <br/>
 * 创建时间：2022/01/21 19:54 <br/>
 */
public class DefaultAddJwtTokenExtData implements AddJwtTokenExtData {
    @Override
    public Map<String, Object> addExtData(HttpServletRequest request, TokenConfig tokenConfig, UserInfo userInfo, Map<String, Object> extData) {
        BasLoginAgent loginAgent = (BasLoginAgent) request.getAttribute(EnumConstant.REQUEST_ATTR_LOGIN_AGENT);
        extData.put(EnumConstant.JWT_EXT_LOGIN_ID, loginAgent.getLoginId());
        return extData;
    }
}
